#include "Etiquette.h"

typedef string::const_iterator constStrItr;


Etiquette::Etiquette() {
	this->symboles = "";
}

Etiquette::Etiquette(string symboles) {
	this->symboles = symboles;
}

Etiquette::~Etiquette(){ }

string Etiquette::getSymboles() const {
	return symboles;
}

bool Etiquette::operator==(string symboles) const
{
	return this->symboles == symboles;
}

bool Etiquette::contientSymbole(char c) const
{
	for (constStrItr it = symboles.begin(); it != symboles.end(); ++it)
	{
		if (*it == c)
			return true;
	}
	return false;
}

void Etiquette::addSymboles(string c)
{
	for (constStrItr it = c.begin(); it != c.end(); ++it)
		addSymbole(*it);
}

unsigned Etiquette::size() const
{
	return symboles.size();
}

void Etiquette::addSymbole(char c)
{
	if (!contientSymbole(c))
		symboles.push_back(c);
}

Etiquette Etiquette::operator+(const Etiquette& right) const
{
	Etiquette retour = *this;
	retour.addSymboles(right.getSymboles());
	return retour;
}

Etiquette& Etiquette::operator+=(const Etiquette& right)
{
	Etiquette& left = *this;
	left.addSymboles(right.getSymboles());
	return left;
}
